package org.dingfugui.triple.demo.producer;

import org.dingfugui.triple.context.DefaultServiceContext;
import org.dingfugui.triple.context.producer.DefaultExecuteHandler;
import org.dingfugui.triple.demo.api.FooService;
import org.dingfugui.triple.protocol.binary.aio.AioProtocol;

import java.io.IOException;

/**
 * @author fugui.ding at 2015/6/17
 */
public class Producer {

    public static void main(String[] args) throws InterruptedException, IOException {
        DefaultServiceContext ctx = new DefaultServiceContext();


        AioProtocol p = new AioProtocol(new DefaultExecuteHandler(ctx));
  /*      ((AioAcceptor) p.getAcceptor()).setWorkThreadPool(new ThreadPoolExecutor(1, 1,
                0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>(),
                new ThreadFactory() {
                    public Thread newThread(Runnable r) {
                        Thread t = new Thread(r);

                        t.setName("afsdfsd");

                        return t;
                    }
                }));*/

        ctx.setProtocol(p);


        ctx.register(FooService.class, new FooServiceImpl());
        ctx.start();

        Thread.sleep(1000000000);

    }


}
